package com.woniu.cq.medical.dao.mymapper;

import com.woniu.cq.medical.dao.MedicalCardMapper;
import com.woniu.cq.medical.entity.MedicalCard;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.context.annotation.Primary;

@Primary
public interface My_MedicalCardMapper extends MedicalCardMapper {
    /**
     * 修改卡的正常卡的状态为注销
     * @param medicalCard
     */
    @Update("update lonbon_medical_card set medical_card_status=#{medicalCardStatus},"+
            "medical_card_last_modification_time=#{medicalCardLastModificationTime}"+
            " where patient_id=#{patientId} and medical_card_status='0'")
    void updateCard(MedicalCard medicalCard);

    /**
     * 根据病人id和正常状态查看是否存在
     * @param patientId
     * @return
     */
    @Select("select * from lonbon_medical_card where patint_id=#{patientId} and medical_card_status='0'")
    MedicalCard selectCard(int patientId);
}
